﻿using GameEntitySystem;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Engine;
using Engine.Graphics;
using Game;

namespace SCIENEW
{
	public class SpinnerDevice : FourDirectionalDevice, ICrafterDevice<ComponentSpinner>, IElectricElementDevice
	{
		public SpinnerDevice() : base("SpinnerDevice", 186, upSlot: 118, sideSlot: 186, downSlot: 186, backSlot: 186, rotate: true)
		{
		}
		public string GetEntityName(int value) => "Spinner";
		public Widget GetWidget(IInventory inventory, ComponentSpinner component) => new SpinnerWidget(inventory, component);
		public override DeviceBehavior[] GetBehaviors(Project project) => [new SpinnerDeviceBehavior(project)];
        public override string GetSoundMaterialName(SubsystemTerrain subsystemTerrain, int value) => "Wood";

        public override int GetDisplayOrder(int value) => base.GetDisplayOrder(value) - 1;

        public ElectricElement CreateElectricElement(SubsystemElectricity subsystemElectricity, int value, int x, int y, int z) => new CrafterPopResultsElectricElement(subsystemElectricity, new Point3(x, y, z), GetDirection(value));

        public ElectricConnectorType? GetConnectorType(SubsystemTerrain terrain, int value, int face, int connectorFace, int x, int y, int z) => ElectricConnectorType.Input;

        public int GetConnectionMask(int value) => int.MaxValue;
    }
}
